#include "mystdio.h"
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>

int main()
{
    MyFile *fp = MyFopen("log.txt","a");
    if(!fp)
    {
        printf("MyFopen error");
        return 1;
    }
   
    int cnt = 10;
   while(cnt--)
   {
       const char *msg = "hello myfile!!!";
       //const char *msg = "hello myfile!!!\n";
       MyFwrite(msg, strlen(msg), fp);
       MyFlush(fp);
       printf("buffer: %s\n", fp->outbuffer);
       sleep(1);
   }
   MyFclose(fp);
    return 0;
}
